package com.mg.yygh.hosp.controller;

import com.mg.yygh.common.result.Result;
import com.mg.yygh.hosp.service.ScheduleService;
import com.mg.yygh.model.hosp.Schedule;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.annotation.RequestScope;

import java.util.List;
import java.util.Map;

/**
 * @author M_Dragon
 * @date 2022/9/4/004 16:32
 */
@Api(tags = "排班日期和数量")
@RestController
@RequestMapping("/admin/hosp/schedule/")
//@CrossOrigin
public class ScheduleController {
    @Autowired
    private ScheduleService scheduleService;

    @ApiOperation("查询排班日期及数量")
    @GetMapping("/getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
        public Result getScheduleRule(@PathVariable("page") Long page,
                                  @PathVariable("limit") Long limit,
                                  @PathVariable("hoscode") String hoscode,
                                  @PathVariable("depcode") String depcode){
        Map<String,Object> map = scheduleService.getScheduleRule(page,limit,hoscode,depcode);
        return Result.ok(map);
    }

    @ApiOperation("查询当天排班信息")
    @GetMapping("/getDetailSchedule/{hoscode}/{depcode}/{workDate}")
    public Result getDetailSchedule(@PathVariable("hoscode") String hoscode,
                                    @PathVariable("depcode") String depcode,
                                    @PathVariable("workDate") String workDate){
        List<Schedule> scheduleList = scheduleService.getDetailSchedule(hoscode,depcode,workDate);
        return Result.ok(scheduleList);
    }
}
